#!/bin/bash -f
awk '{print length($1),$0}' py2apy.map | sort -n -r -k 1 | awk "{printf(\"s/\\\([^ \\\^]\\\)%s/\\\1%s/gI\n\",\$2,\$3); printf(\"s/ \\\+%s/'%s/gI\n\",\$2,\$3);}" > py2apy.sed
sed -e '/^\s*\#.*$/d' -e 's|^\([^ ]\+\) \([^ ]\+\) \[\([A-Za-z0-9:,· ]\+\)\].\+$|\3\|\1\|\2|g' -f py2apy.sed -e 's/ //g' -e 's/|/ /g' $1 | sort -f
